package com.qpx.logmongodb.web;


import com.qpx.logmongodb.eneity.LogEntity;
import com.qpx.studentservice.vo.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LogController {

    @Autowired
    MongoTemplate mongoTemplate;

    @RequestMapping(value = "/log/add", method = RequestMethod.POST)
    public ResultEntity add(@RequestBody LogEntity logEntity) {
        mongoTemplate.save(logEntity, "log");
        return ResultEntity.ok();
    }
}
